import java.util.HashMap;
import java.util.HashSet;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2024-10-05
 * Time: 9:47
 */
//https://leetcode.cn/problems/contains-duplicate/submissions/570118973/
//存在重复元素(易)
public class Solution3 {
    public boolean containsDuplicate(int[] nums) {
        HashSet<Integer> set=new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            if(!set.add(nums[i])){
                return false;
            }
        }
        return true;
    }
}
